<template>
  <div>
    <div v-if="show" class="cus">
      <div class="cus_box">
        <div class="title"><span>异常记录</span><i @click="show=false" class="el-icon-close"></i></div>
        <div class="content">
          <el-table :data="tableData" height="250" border style="width: 100%">
            <el-table-column prop="id" label="ID" width="180">
            </el-table-column>
            <el-table-column prop="stime" label="时间" width="180">
            </el-table-column>
            <el-table-column prop="alarm" label="异常信息">
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button @click="del(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
  </div>

</template>

<script>
export default {
  name: "Abnormal_record",
  data() {
    return {
      show: false,
      tableData: [],
      row: {}
    }
  },
  mounted() {

  },
  methods: {
    async getData() {
      const res = await this.apis.alarm_list({
        pageNum: 1,
        pageSize: 100000,
        sn: this.row.sn
      });

      const list = res.rows || [];
      this.tableData = list;

    },
    del(row) {
      this.$confirm('确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {

        const res = await this.apis.alarm_del({
          id: row.id
        });

        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {

      });
    },
    show_fun(row) {
      this.row = row;
      this.show = true;
      this.getData();
    }
  }
}
</script>

<style scoped lang="scss">
</style>
